package pers.cj.pdos.service;

import pers.cj.pdos.entity.*;
import com.baomidou.mybatisplus.extension.service.IService;
import pers.cj.pdos.vo.SaleVo;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 当销售单产生后，订单会进入待出库状态，需要仓库管理员进行出库操作 服务类
 * </p>
 *
 * @author chenj
 * @since 2019-11-04
 */
public interface ISaleService extends IService<Sale> {

    boolean checkClose(Sale sale);
    boolean checkNo(String no, String companyId);

    void insert(BusinessSet businessSet, Sale sale,
                List<SaleGoods> saleGoodsList, List<GoodsSn> goodsSnList, List<GoodsSnLog> goodsSnLogList,
                List<SalePacket> salePacketList, List<SalePacketGoods> salePacketGoodsList);

    void retailInsert(Sale sale,
                      List<SaleGoods> saleGoodsList, List<GoodsSn> goodsSnList, List<GoodsSnLog> goodsSnLogList,
                      List<SalePacket> salePacketList, List<SalePacketGoods> salePacketGoodsList);

    void close(Sale sale, BusinessSet businessSet);

    List<SaleVo> listVo(String companyId,
                        Integer page,
                        Integer limit,
                        Boolean close,
                        String search,
                        String no,
                        String goodsName,
                        String remark,
                        String storeId,
                        String houseId,
                        String settAccountId,
                        String custom,
                        Date deliveryDate1,
                        Date deliveryDate2,
                        Date makeTime1,
                        Date makeTime2,
                        String userStoreId,
                        String userId,
                        Date date1,
                        Date date2,
                        Date date,
                        String makeUserId,
                        String customId,
                        Integer status);

    long count(String companyId,
               Boolean close,
               String search,
               String no,
               String goodsName,
               String remark,
               String storeId,
               String houseId,
               String settAccountId,
               String custom,
               Date deliveryDate1,
               Date deliveryDate2,
               Date makeTime1,
               Date makeTime2,
               String userStoreId,
               String userId,
               Date date1,
               Date date2,
               Date date,
               String makeUserId,
               String customId,
               Integer status);

    List<SaleVo> listVoForTicket(String companyId,
                                 Integer page,
                                 Integer limit,
                                 Integer ticket,
                                 String search,
                                 String no,
                                 String goodsName,
                                 String remark,
                                 String storeId,
                                 String houseId,
                                 String settAccountId,
                                 String custom,
                                 Date deliveryDate1,
                                 Date deliveryDate2,
                                 Date makeTime1,
                                 Date makeTime2,
                                 String userStoreId,
                                 String userId,
                                 Date date1,
                                 Date date2,
                                 String makeUserId);

    long countForTicket(String companyId,
                        Integer ticket,
                        String search,
                        String no,
                        String goodsName,
                        String remark,
                        String storeId,
                        String houseId,
                        String settAccountId,
                        String custom,
                        Date deliveryDate1,
                        Date deliveryDate2,
                        Date makeTime1,
                        Date makeTime2,
                        String userStoreId,
                        String userId,
                        Date date1,
                        Date date2,
                        String makeUserId);

    List<SaleVo> listVoForSelect(String companyId,
                                 Integer page,
                                 Integer limit,
                                 String search,
                                 String storeId,
                                 String userStoreId,
                                 String userId);

    Long countForSelect(String companyId,
                        String search,
                        String storeId,
                        String userStoreId,
                        String userId);

    SaleVo getVoById(String id);

    List<SaleVo> listVoByIds(List<String> ids);

    List<SaleVo> listVoBySaleOrder(String saleOrderId);

    SaleVo getLastRetailByUserId(String userId);

    List<SaleVo> listVoByBorrowOut(String borrowOutId);

    boolean checkTicket(List<String> ids);

    void batchTicket(List<String> ids);
}
